<?php
/**
 * Created by PhpStorm
 * author: bxm
 * Date: 2023/3/8
 * Time: 10:04
 */

namespace app\admin\model;

use app\common\model\TimeModel;

class Order extends TimeModel
{
    protected $name = "order";

    protected $deleteTime = "delete_time";



    // 设置json类型字段，你需要将字段名称和别名一起加入
    protected $json = ['back_files','upload_imgs','cost_files'];

    // 设置JSON数据返回数组
    protected $jsonAssoc = true;

    public function createAdmin()
    {
        return $this->belongsTo('app\common\model\AdminModel','action_admin_id','id')->field(['id,nickname']);
    }
    public function orderCustomer()
    {
        return $this->belongsTo('app\common\model\worker\CustomerModel','customer_id','id')->field(['id,name']);
    }

    public function orderGoods()
    {
        return $this->belongsTo('app\common\model\worker\CustomerGoodsDataModel','goods_data_id','id')->field(['id,goods_name']);
    }

    public function installAdmin()
    {
        return $this->belongsTo('app\common\model\AdminModel','install_admin_id','id')->field(['id,nickname']);
    }
}